package com.mcp.converter.domain.converter;

import java.util.List;
import java.util.Map;

/**
 * SQL转换结果类
 */
public class ConversionResult {
    
    /**
     * 原始SQL语句
     */
    private String originalSQL;
    
    /**
     * 转换后的SQL语句
     */
    private String convertedSQL;
    
    /**
     * 转换是否成功
     */
    private boolean successful;
    
    /**
     * 转换详情列表
     */
    private List<ConversionDetail> conversionDetails;
    
    /**
     * 附加属性
     */
    private Map<String, Object> attributes;
    
    public ConversionResult() {
        this.conversionDetails = new java.util.ArrayList<>();
        this.attributes = new java.util.HashMap<>();
    }
    
    public ConversionResult(String originalSQL, String convertedSQL, boolean successful) {
        this();
        this.originalSQL = originalSQL;
        this.convertedSQL = convertedSQL;
        this.successful = successful;
    }
    
    public String getOriginalSQL() {
        return originalSQL;
    }
    
    public void setOriginalSQL(String originalSQL) {
        this.originalSQL = originalSQL;
    }
    
    public String getConvertedSQL() {
        return convertedSQL;
    }
    
    public void setConvertedSQL(String convertedSQL) {
        this.convertedSQL = convertedSQL;
    }
    
    public boolean isSuccessful() {
        return successful;
    }
    
    public void setSuccessful(boolean successful) {
        this.successful = successful;
    }
    
    public List<ConversionDetail> getConversionDetails() {
        return conversionDetails;
    }
    
    public void setConversionDetails(List<ConversionDetail> conversionDetails) {
        this.conversionDetails = conversionDetails;
    }
    
    public Map<String, Object> getAttributes() {
        return attributes;
    }
    
    public void setAttributes(Map<String, Object> attributes) {
        this.attributes = attributes;
    }
    
    /**
     * 添加转换详情
     * @param conversionDetail 转换详情
     */
    public void addConversionDetail(ConversionDetail conversionDetail) {
        if (conversionDetail != null) {
            this.conversionDetails.add(conversionDetail);
        }
    }
    
    /**
     * 获取转换详情数量
     * @return 转换详情数量
     */
    public int getConversionDetailCount() {
        return this.conversionDetails.size();
    }
    
    /**
     * 添加属性
     * @param key 属性键
     * @param value 属性值
     */
    public void addAttribute(String key, Object value) {
        this.attributes.put(key, value);
    }
    
    /**
     * 获取属性
     * @param key 属性键
     * @return 属性值
     */
    public Object getAttribute(String key) {
        return this.attributes.get(key);
    }
}
